import cn.edu.cupk.factorymethod.fruit.Factory;
import cn.edu.cupk.factorymethod.fruit.Car;

import java.util.ArrayList;
import java.util.List;

//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
    public static void main(String[] args) {
        //TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
        // to see how IntelliJ IDEA suggests fixing it.
        //System.out.printf("Hello and welcome!");

//        Fruit fruit1,fruit2,fruit3;
//        fruit1 = Factory.getFruitInstanceByType("香蕉");
//        fruit2 = Factory.getFruitInstanceByType("苹果");
//        fruit3 = Factory.getFruitInstanceByType("桔子");
//        System.out.println(fruit1.showName());
//        System.out.println(fruit2.showName());
//        System.out.println(fruit3.showName());

        List<Car> carList = new ArrayList<Car>();

        carList.add(Factory.getFruitInstanceByType("宝马"));
        carList.add(Factory.getFruitInstanceByType("法拉利"));
        carList.add(Factory.getFruitInstanceByType("奔驰"));

        for (Car currentCar : carList){
            System.out.println(currentCar.showName());
        }






    }
}